#include <bits/stdc++.h>

using namespace std;

struct Block{
    int num;
    int all;
    int x, y;
};

int n;
vector<int> a;
map<int, int> m;
vector<Block> b; 

void duel(){
    int f = 0;
    for (int i = 0; i < b.size() && i >= 0; ++i){
        if (i == 0){
            continue;
        }
        if (b[i].x == 0){
            continue;
        }
        Block &x = b[i], &y = b[i - 1];
        if (x.x == y.all){
            x.x = 0, x.y = x.all;
            y.all = 0, y.x = 0, y.y = 0;
        }
        else if (x.x < y.all){
            y.all -= x.x;
            x.y = x.all;
            if (x.x <= y.y){
                y.y -= x.x;
            }
            else{
                y.x -= (x.x - y.y);
                y.y = 0;
            }
            x.x = 0;
        }
        else{
            x.x -= y.all, x.y += y.all;
            y.all = 0, y.x = 0, y.y = 0;
        }
        if (y.all == 0){
            b.erase(b.begin() + i - 1);
            i--;
        }
        f = 1;
    }
    if (f){
        duel();
    }
    return;
}

int main(){
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);

    cin >> n;

    for (int i = 0; i < n; ++i){
        int x;
        cin >> x;
        m[x]++;
        a.push_back(x);
    }

    for (auto itr = m.begin(); itr != m.end(); ++itr){
        b.push_back({itr->first, itr->second, itr->second, 0});
    }

    duel();

    int ans = 0;
    for (int i = 0; i < b.size(); ++i){
        ans += b[i].all;
    }
    cout << ans << endl;
    return 0;
}